/*     */ package com.infoservice.schedule.test;
/*     */ 
/*     */ import com.infoservice.po3.POFactory;
/*     */ import com.infoservice.po3.POFactoryBuilder;
/*     */ import com.infoservice.po3.core.context.POContext;
/*     */ import com.infoservice.po3.core.util.ContextUtil;
/*     */ import com.infoservice.schedule.po.pos.TaskInfoPO;
/*     */ import com.infoservice.schedule.po.pos.TaskPlanPO;
/*     */ 
/*     */ public class DBInit
/*     */ {
/*  30 */   protected POFactory factory = null;
/*     */ 
/*  32 */   public long initTaskInfo(String manual, int priority, String type) { TaskInfoPO taskInfo = new TaskInfoPO();
/*  33 */     taskInfo.setActionDesc("测试");
/*  34 */     taskInfo.setActionId("com.infoservice.schedule.test.TaskImpl");
/*  35 */     taskInfo.setActionName("TaskImpl");
/*  36 */     taskInfo.setP1name("p1name");
/*  37 */     taskInfo.setP2name("p2name");
/*  38 */     taskInfo.setP3name("p3name");
/*  39 */     taskInfo.setP4name("p4name");
/*  40 */     taskInfo.setP5name("p5name");
/*  41 */     taskInfo.setTaskDuration(Integer.valueOf(100000));
/*  42 */     taskInfo.setTaskManual(manual);
/*  43 */     taskInfo.setTaskPriority(Integer.valueOf(priority));
/*  44 */     taskInfo.setTaskStatus(Integer.valueOf(1));
/*  45 */     taskInfo.setTaskType(type);
/*  46 */     long taskId = this.factory.getLongPK(taskInfo).longValue();
/*  47 */     taskInfo.setTaskId(Long.valueOf(taskId));
/*  48 */     this.factory.insert(taskInfo);
/*  49 */     return taskId; }
/*     */ 
/*     */   public void initTaskPlan(long taskId, String repeatType, int runType, int priority) {
/*  52 */     TaskPlanPO tp = new TaskPlanPO();
/*  53 */     tp.setTaskId(Long.valueOf(taskId));
/*  54 */     tp.setP1value("p1value");
/*  55 */     tp.setP2value("p2value");
/*  56 */     tp.setP3value("p3value");
/*  57 */     tp.setP4value("p4value");
/*  58 */     tp.setP5value("p5value");
/*  59 */     tp.setPlanEnd("18:00");
/*  60 */     tp.setPlanExecuteTimes(Long.valueOf(0L));
/*  61 */     tp.setPlanId(this.factory.getLongPK(tp));
/*  62 */     tp.setPlanRepeatType(repeatType);
/*  63 */     if ((repeatType.equals("HOUR")) || (repeatType.equals("MINUTE"))) {
/*  64 */       tp.setPlanIgnoreFlag(Integer.valueOf(0));
/*  65 */       tp.setTaskInterval(Integer.valueOf(5));
/*  66 */       tp.setPlanStartTimeout(Integer.valueOf(5));
/*  67 */       tp.setPlanRunType(Integer.valueOf(-1));
/*     */     } else {
/*  69 */       tp.setPlanIgnoreFlag(Integer.valueOf(1));
/*  70 */       if (repeatType.equals("WEEK")) {
/*  71 */         tp.setPlanPattern("W1");
/*     */       }
/*  73 */       if (repeatType.equals("MONTH")) {
/*  74 */         tp.setPlanPattern("M30");
/*     */       }
/*  76 */       if (repeatType.equals("YEAR")) {
/*  77 */         tp.setPlanPattern("7-28");
/*     */       }
/*  79 */       if (repeatType.equals("ONLYONE")) {
/*  80 */         tp.setPlanPattern("2009-07-28");
/*     */       }
/*     */     }
/*  83 */     tp.setPlanPriority(Integer.valueOf(priority));
/*  84 */     tp.setPlanStart("03:10");
/*  85 */     tp.setPlanStatus(Integer.valueOf(1));
/*  86 */     this.factory.insert(tp);
/*     */   }
/*     */   public void init() {
/*     */     try {
/*  90 */       this.factory = POFactoryBuilder.getInstance();
/*  91 */       long id = initTaskInfo("SYSTEM", 5, "SYS");
/*  92 */       initTaskPlan(id, "MINUTE", 0, 6);
/*  93 */       long id2 = initTaskInfo("SYSTEM", 5, "SYS");
/*  94 */       initTaskPlan(id2, "HOUR", 0, 6);
/*  95 */       long id3 = initTaskInfo("SYSTEM", 5, "SYS");
/*  96 */       initTaskPlan(id3, "DAY", 0, 6);
/*  97 */       long id4 = initTaskInfo("SYSTEM", 5, "SYS");
/*  98 */       initTaskPlan(id4, "WEEK", 0, 6);
/*  99 */       long id5 = initTaskInfo("SYSTEM", 5, "SYS");
/* 100 */       initTaskPlan(id5, "MONTH", 0, 6);
/* 101 */       long id6 = initTaskInfo("SYSTEM", 5, "SYS");
/* 102 */       initTaskPlan(id6, "YEAR", 0, 6);
/* 103 */       long id7 = initTaskInfo("SYSTEM", 5, "SYS");
/* 104 */       initTaskPlan(id7, "ONLYONE", 0, 6);
/* 105 */       POContext.endTxn(true);
/*     */     } catch (Throwable t) {
/* 107 */       POContext.endTxn(false);
/* 108 */       t.printStackTrace();
/*     */     } finally {
/* 110 */       POContext.cleanTxn();
/*     */     }
/*     */   }
/*     */ 
/*     */   public static void main(String[] args)
/*     */   {
/* 117 */     DBInit init = new DBInit();
/* 118 */     ContextUtil.loadConf();
/* 119 */     init.init();
/*     */   }
/*     */ }

/* Location:           D:\Workspace\Work\ASMP_DE\lib\frame3\InfoSchedule_1.0.03.jar
 * Qualified Name:     com.infoservice.schedule.test.DBInit
 * JD-Core Version:    0.6.0
 */